package iterator;


import iterator.iterator.CafeMenu;
import iterator.iterator.CakeHouseMenu;
import iterator.iterator.DinerMenu;
import iterator.iterator.Waitress;

/**
　　* @description: 迭代器模式
   * 提供一种对象间的聚合方式 适合不同容器间的遍历
　　* @author 周杨
　　* @date 2019/5/29  11:46
　　*/
public class Main {
    public static void main(String[] args) {
        Waitress waitress = new Waitress();
        CakeHouseMenu cakeHouseMenu = new CakeHouseMenu();
        DinerMenu dinerMenu = new DinerMenu();
        CafeMenu cafeMenu = new CafeMenu();
        waitress.addIterator(cakeHouseMenu.getIterator());
        waitress.addIterator(dinerMenu.getIterator());
        waitress.addIterator(cafeMenu.getIterator());
        waitress.printMenu();
    }
}
